package com.snifferx.util;

import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;

import org.jboss.logging.Logger;

@SuppressWarnings("serial")
public class PhaseTracker implements PhaseListener {
	private static final Logger logger = Logger.getLogger(PhaseTracker.class);

	private static final long serialVersionUID = 1L;

	@Override
	public void beforePhase(PhaseEvent phaseEvent) {
		logger.debug("BEFORE PHASE " + phaseEvent.getPhaseId());

	}

	@Override
	public void afterPhase(PhaseEvent phaseEvent) {
		logger.debug("AFTER PHASE " + phaseEvent.getPhaseId());
		if (phaseEvent.getPhaseId() == PhaseId.RENDER_RESPONSE) {
			logger.debug("REQUEST END\n\n");
		}

	}

	@Override
	public PhaseId getPhaseId() {
		return PhaseId.ANY_PHASE;
	}

}
